<template>
  <view>
    <view class="u-p-r-30" v-if="studentList.length">
      <view class="title u-p-b-30 u-p-t-30 u-flex flex-between">
        <view class="title-txt u-p-l-20 u-font-36">指北星优秀学生</view>
        <navigator :url="`/pages/index/study/type_list?name=指北星优秀学生`" class="color-active u-font-xs u-flex u-center">
          <view style="color: #8A8A8A">更多</view>
          <u-icon name="arrow-right" color="#8A8A8A" size="22" class="u-m-l-10"></u-icon>
        </navigator>
      </view>
      <view class="u-p-l-30">
        <study_list :datas="studentList"></study_list>
      </view>
    </view>
    <view class="u-p-r-30" v-if="schoolList.length">
      <view class="title u-p-b-30 u-p-t-30 u-flex flex-between">
        <view class="title-txt u-p-l-20 u-font-36">合作院校</view>
        <navigator :url="`/pages/index/study/type_list?name=合作院校`" class="color-active u-font-xs u-flex u-center">
          <view style="color: #8A8A8A">更多</view>
          <u-icon name="arrow-right" color="#8A8A8A" size="22" class="u-m-l-10"></u-icon>
        </navigator>
      </view>
      <view class="u-p-l-30">
        <study_list :datas="schoolList"></study_list>
      </view>
    </view>
  </view>
</template>

<script>
  import {request} from "../../../util/api";
  import study_list from "./study_list";

  export default {
    name: "list",

    components: {
      study_list
    },

    data() {
      return {
        list: [],
        studentList: [],
        schoolList: []
      }
    },

    mounted() {
      this.getList()
    },

    methods: {
      getList() {
        request({
          url: '/system/wx/CompassCaseStudy/list',
          token: true,
          data: {
            pageNum: 1,
            pageSize: 999
          }
        }).then(res=> {
          this.list = this.list.concat(res.rows)
          this.list.forEach(item => {
            if (item.listChosen) {
              if (item.exampleType == '指北星优秀学生') {
                this.studentList.push(item)
              } else {
                this.schoolList.push(item)
              }
            }
          })
        })
      },
    }
  }
</script>

<style scoped lang="scss">
  .title {
    .title-txt {
      border-left: 8upx solid $btn_active_bg_color;
      line-height: 30upx;
      color: #101010;
    }
  }
</style>
